<?php
/**
 * Hoffman Framework
 *
 * LICENSE
 *
 * This source file is subject to the GNU LGPL 2.1 license that is bundled
 * with this package in the file license.txt.
 * It is also available through the world-wide-web at this URL:
 * http://creativecommons.org/licenses/LGPL/2.1
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to annop@thaicyberpoint.com so we can send you a copy immediately.
 *
 * @package    Hoffman
 * @author     Ford AntiTrust
 * @copyright  Copyright (c) 2008 Ford AntiTrust (http://www.thaicyberpoint.com/ford/blog)
 * @since      Version Rv 0.2
 * @license    http://creativecommons.org/licenses/LGPL/2.1
 *             GNU LGPL 2.1
 * @filesource
 */

if (!defined('INDEX'))
    die('No direct script access allowed.');

/**
 * @see Zend_Register
 */
require_once 'Zend/Registry.php';
/**
 * @see Hmf_Locale
 */
require_once 'Hmf/Locale.php';
/**
 * @see Hmf_Translate
 */
require_once 'Hmf/Translate.php';
/**
 * @see Hmf_Httppage
 */
require_once 'Hmf/Httppage.php';

/**
 * Hmf
 *
 * @package     Hoffman
 * @author      Ford AntiTrust
 * @version     SVN: $Id: Hmf.php 167 2010-02-18 10:32:16Z annop.s@gmail.com $
 * @link        http://www.thaicyberpoint.com/ford/blog/hmf
 *
 * @method string _t() _t(string $str)
 * @method null _e() _e(string $str)
 * @method string _s() _s(string $pattern, $args1[, ... $argsN])
 * @method null _p() _p(string $pattern, $args1[, ... $argsN])
 */

abstract class Hmf {

    /**
     * Store Hmf_Locale instance
     *
     * @var Hmf_Locale
     */
    private static $locale;

    /**
     * Store Hmf_Translate instance
     *
     * @var Hmf_Translate
     */
    private static $translate;

    /**
     * @see Hmf_Translate#_t()
     * @see Hmf_Translate#_e()
     * @see Hmf_Translate#_s()
     * @see Hmf_Translate#_p()
     */
    protected function __call($method, $args) {

        if (in_array($method, array("_t", "_e", "_s", "_p"))) {
            return call_user_func_array(array('Hmf_Translate', $method), $args);
        }
        return false;
    }

    /**
     * @see Hmf_Httppage#isCurrentUrlAction()
     */
    final protected function _isCurrentUrlAction() {

        $args = func_get_args();
        return call_user_func_array(array('Hmf_Httppage', 'isCurrentUrlAction'), $args);
    }

    /**
     * @see Hmf_Routing#getCurrentUrlAction()
     */
    final protected function _getCurrentUrlAction() {

        return Zend_Registry::get('routing_url')->getCurrentUrlAction();
    }

    /**
     * @see Hmf_Httppage#url()
     */
    final protected function _url() {

        $args = func_get_args();
        return call_user_func_array(array('Hmf_Httppage', 'url'), $args);
    }

    /**
     * @see Hmf_Httppage#baseUrl()
     */
    final protected function _baseUrl() {

        $args = func_get_args();
        return call_user_func_array(array('Hmf_Httppage', 'baseUrl'), $args);
    }

    /**
     * @see Hmf_Locale
     */
    final protected static function _locale() {

        if (!isset(self::$locale))
            self::$locale = new Hmf_Locale();

        return self::$locale;
    }

    /**
     * @see Hmf_Translate
     */
    final protected static function _translate() {

        if (!isset(self::$translate))
            self::$translate = new Hmf_Translate();

        return self::$translate;
    }
}
?>